<div class="span10" id="_content" style="background: #fff;margin-left: 2px;padding:0px;">
<table width="100%" style="margin: 0;padding: 0;">
    <tr>
        <td class="hzbar"></td>
        <td style="padding: 10px 15px;">
            <?php echo $this->session->flashdata('_message'); ?>
<!-- Modal Form -->
<?php echo $action; ?>
<?php echo anchor('administrator/shop/product/create','<i class="icon-plus"></i>Add new product','class="btn"'); ?>
<div style="margin-bottom: 15px;"></div>
<?php
if(!empty($products)){
?>
    <table class="table table-striped table-bordered table-condensed">
        <?php 
            foreach($products as $pro):
        ?>
        <tr>
            <td><?php echo  $pro->product_id ?></td>
            <td width="280"><div class="thumbnails">
                <li>
            <?php $detail = $this->_global->_unserialize($pro->product_detail);
                if(!empty($detail)){
                    $images = $detail['options']['colors'];
                    $keys = array_keys($images);
                    $rand = rand(0,count($keys)-1);
                    $images = $detail['options']['colors'][$keys[$rand]]['images']; 
                    $rand = rand(0,count($images)-1);                 
            ?>
               <a href="#" class="thumbnail">
                        <img src="<?php echo $this->config->item('cdn_url') ?>exec/timthumb.php?src=<?php echo $images!=null ? site_url().$images[0]:""; ?>&h=260&w=280&zc=1" alt=""/>
                    </a>
            <?php
            
                }
             ?></li></div></td>
            <td><?php
                $productname = $this->_global->_unserialize($pro->product_name);
                if(!empty($productname[$this->session->userdata('lan')]))
                echo $productname[$this->session->userdata('lan')]['product_name'];
                else
                echo 'Không tồn tại tên sản phẩm với ngôn ngữ hiện tại';
            ?></td>
            <td>
            <?php echo anchor('administrator/shop/product/detail/'.$pro->product_id,'<i class="icon-cog"></i> Options', 'class="btn action"') ?>
            </td>
            <td>
            <?php echo anchor('administrator/shop/product/edit/'.$pro->product_id,'<i class="icon-edit"></i> Edit', 'class="btn action"') ?>
            </td>
            <td>
<?php echo anchor('administrator/shop/product/delete/'.$pro->product_id,'<i class="icon-remove"></i> Delete', 'class="btn action" onclick="return confirm(\'Do you want to delete this product?\')"') ?>
            </td>
        </tr>
        <?php endforeach; ?>
    </table>
<?php
}else{
    echo '<div class="alert alert-info"><h4 class="alert-heading">Thông báo!</h4>Chưa có sản phẩm nào...</div>';
}
?>
        </td>
    </tr>
</table>
</div>